<?php

class DefaultController extends Controller
{
	public function actionIndex($category='')
	{
                $criteria=new CDbCriteria;
                $criteria->select='title, alt_title, image, short_story, date';  // выбираем только поле 'id,title'
                //$criteria->condition='parent_id=:parent_id';
                //$criteria->params=array(':parent_id'=>0);
                $criteria->order='id DESC';
                
                $count=News::model()->count($criteria);
                $pages=new CPagination($count);
                $pages->pageSize=5;
                $pages->applyLimit($criteria);

                $model = News::model()->findAll($criteria);
                $this->render('index', array('model'=>$model, 'pages' => $pages));
		
	}
        
        

       
}